POV-Ray : Newsgroups : povray.general : Speed up Boolean : Speed up Boolean Server Time
30 Jul 2024 12:19:15 EDT (-0400)
  Speed up Boolean  
From: P Brewer
Date: 8 Feb 2009 20:20:00
Message: <web.498f84077cfd3c13916e2c9f0@news.povray.org>
Are there any tricks to speed up "complex" boolean objects?

I have a hockey puck, with several thousand small prisms cut from the side to
make a knurl texture on the side. I've manually bounded the puck, but POV still
crawls once it starts rendering that surface.

I'm hoping that by altering the way I put the initial objects together, I can
speed it up.

Here is the code I have:

#declare puck_r = .07;

#declare puck_base =
merge{
  cylinder{ <0,0,0> <0,1,0>, 1.5-puck_r }
  cylinder{ <0,puck_r,0> <0,1-puck_r,0>, 1.5 }
  torus{ 1.5-puck_r,puck_r translate puck_r*y }
  torus{ 1.5-puck_r,puck_r translate (1-puck_r)*y }
  }

#declare logo =
height_field{
  png "logo_heightfield.png"
  smooth
  translate -.5
  scale <2.6,-.02,2.6>
  translate <0,0,-.25>
  texture{ frosted_glass }
}

#declare knurl_piece =
prism{
  linear_spline conic_sweep
  1,0,5,
  <-1,-1>, <-1,1>, <1,1>, <1,-1>, <-1,-1>
  rotate 45*y
  scale <1.2,-1,1>
  translate 1*y
  rotate 90*x
  scale .015
  translate -.5*y
  }

#declare counter = 0;
#declare total = 20;
#declare knurl_row =
union{
  #while ( counter < total )
    object{
      knurl_piece
      translate counter/20*y
      }
    #declare counter = counter+1;
  #end
}

#declare knurl_row1 =
intersection{
  cylinder{ <0,-.5+puck_r,0> <0,.5-puck_r,0>, 2 }
  object{ knurl_row }
  }

#declare knurl_row2 =
intersection{
  cylinder{ <0,-.5+puck_r,0> <0,.5-puck_r,0>, 2 }
  object{ knurl_row translate .5/20*y }
  }

#if ( puck_simple = 1 )
        #declare puck =
          object{ puck_base }
#else
        #declare counter = 0;
        #declare total = 360;
        #declare puck =
        difference{
          object{ puck_base }
          union{
          #while ( counter < total )
            object{ knurl_row1 translate -1.50*z rotate counter*y }
            object{ knurl_row2 translate -1.50*z rotate (counter+1)*y }
            #declare counter = counter + 2;
          #end
          translate .5*y
          }
        }
#end

#declare puck_w_logo =
difference{
  object{ puck texture{ heavy_glass } }
  union{
    object{ logo translate 1*y texture{ frosted_glass } }
    object{ logo scale <1,-1,1> texture{ frosted_glass } }
    }
}

#declare glass_puck =
object{
  puck_w_logo
  hollow
  interior{ ior 1.5 }
  translate .01*y
  rotate -40*y
  bounded_by { cylinder { <0,0,0> <0,1.1,0> 1.55 } }
  }


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.